package com.wmx.thread;

import java.util.stream.IntStream;

public class ThreadOne extends Thread {

    private MyObject myObject;

    ThreadOne(MyObject myObject){
        this.myObject = myObject;
    }

    @Override
    public void run() {

        try {

            synchronized (myObject){
                for(;myObject.num<=52;){
                //while (myObject.num<=52){
                    if(myObject.anInt%2==0){
                        myObject.anInt++;
                        System.out.print(myObject.num);
                        myObject.num++;
                        System.out.print(myObject.num);
                        myObject.num++;
                        myObject.notify();

                    }else {
                        myObject.wait();
                    }
                 }
            }


        }catch (Exception e){
            e.printStackTrace();
        }

    }
}
